package com.wingscode.modules.app.form;

import com.wingscode.modules.common.entity.UserEntity;

import java.math.BigDecimal;

import io.swagger.annotations.ApiModel;
import lombok.Data;

/**
 * 登录表单
 *
 * @author Mark sunlightcs@gmail.com
 */
@Data
@ApiModel(value = "用户信息表单")
public class UserInfoForm {
    private Integer userId;
    private String token;
    /**
     * 用户名
     */
    private String username;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 头像
     */
    private String avatar;
    /**
     * 角色
     */
    private Integer role;
    /**
     * 职位
     */
    private String position;
    /**
     * 是否可报价
     */
    private Integer isOfferPrice;
    /**
     * 公司id
     */
    private Integer agentId;

    private Integer agentState;

    private String agentName;

    private Integer level;

    private String openId;

    private String levelName;

    private String sessionKey;

    public UserInfoForm getUserInfo(UserEntity userEntity) {
        UserInfoForm userInfoForm = new UserInfoForm();
        userInfoForm.setUserId(userEntity.getId());
        userInfoForm.setAvatar(userEntity.getAvatar());
        userInfoForm.setMobile(userEntity.getMobile());
        userInfoForm.setUsername(userEntity.getUsername());
        userInfoForm.setRole(userEntity.getRole());
        userInfoForm.setPosition(userEntity.getPosition());
        userInfoForm.setIsOfferPrice(userEntity.getIsOfferPrice());
        userInfoForm.setAgentId(userEntity.getAgentId());
        userInfoForm.setAgentState(userEntity.getAgentState());
        userInfoForm.setAgentName(userEntity.getAgentName());
        userInfoForm.setLevel(userEntity.getLevel());
        userInfoForm.setLevelName(userEntity.getLevelName());
        userInfoForm.setSessionKey(userEntity.getSessionKey());
        userInfoForm.setOpenId(userEntity.getOpenId());

        return userInfoForm;
    }
}
